public class six_5 {
    public static void main(String[] args) {
        int a = 6;
        int b = climbStairs(a);
        System.out.println(b);
        System.out.println("------");
        int c = fib(a);
        System.out.println(c);
        //System.out.println();
//        int[] nums1 ={1,2,3,4};
//        int[] nums2 ={5,6,7};
//        nums1 = Arrays.copyOf(nums2,nums2.length+nums1.length);
//        System.out.println("------------");
//        System.out.println(nums1);
    }
    public static int climbStairs(int n) {
        if (n == 1){return 1;}
        if (n == 2){return 2;}
        int a = 1,b = 1;
        int sum = 0;
        for (int i=0; i < n-1 ;i++){
            sum = a+b;
            a = b;
            b = sum;
        }
        return sum;
    }
    public static int fib(int n) {
        if (n == 1){return 1;}
        if (n == 2){return 1;}
        int a = 0,b = 1;
        int sum = 0;
        for (int i = 0;i < n-1;i++){
            sum = a+b;
            a = b;
            b = sum;
        }
        return sum;
    }
    public static void merge(int[] nums1, int m, int[] nums2, int n) {
        int i = m+n;
        int[] temp = new int[i];
        for (int j = 0,m1 = 0,n2 = 0 ; j< i;j++){
            if (m1 >= m){
                temp[j] = nums2[n2++];
            }
            else if (n2 >= n) {
                temp[j] = nums1[m1++];
            }
            else if (nums1[m1]<nums2[n2]){
                temp[j] = nums1[m1++];
            }
            else {
                temp[j] = nums2[n2++];
            }

        }
        for (int j = 0;j < temp.length ; j++){
            nums1[j] = temp[j];
        }
    }
    public static void moveZeroes(int[] nums) {
        int[] a = new int[0];
        for (int i = 0; i < nums.length-1 ;i++){
            if (nums[i]==0){
                a[i] = i;
            }
        }
    }
}
